package com.caishi.lkx.exam.service;

import com.caishi.lkx.exam.model.ChapterModel;
import com.caishi.lkx.exam.vo.SpecialConditionVo;
import com.zzw.common.entity.BaseService;
import com.zzw.common.service.NameService;
import com.zzw.common.service.service.ITreeModelServiceV2;
import com.zzw.common.service.service.SortService;

import java.util.List;

public interface IChapterService extends BaseService<ChapterModel, String>,
        NameService<ChapterModel, String>,
        SortService<ChapterModel>,
        ITreeModelServiceV2<ChapterModel, String>,
        QuestionCollectionService<ChapterModel, String> {
    /**
     * 获取科目下配置的顶级章节
     *
     * @param categoryId
     * @return
     */
    List<ChapterModel> categoryTopChapter(Long categoryId);

    /**
     * 获取科目下配置的全部章节
     *
     * @return
     */
    List<ChapterModel> categoryAllChapter(Long categoryId);

    /**
     * 获取科目下配置的所有叶子节点章节
     *
     * @return
     */
    List<ChapterModel> categoryAllLeafChapter(Long categoryId);

    /**
     * 激活章节
     *
     * @param chapterModel
     * @return
     */
    int activation(ChapterModel chapterModel);

    /**
     * 给科目下生成一套章节练习
     *
     * @param categoryId
     * @param questionSourceCategoryId 试题来源的科目
     * @param specialConditionVo
     * @param chapterName
     * @param columnId
     */
    ChapterModel categoryGenerateChapter(Long categoryId, Long questionSourceCategoryId, SpecialConditionVo specialConditionVo, String chapterName, String columnId, List<String> inIds, String parentId);

    /**
     * 根据试题获取章节
     *
     * @param cid        科目id
     * @param questionId 试题id
     * @return
     */
    List<ChapterModel> chapterByQuestionId(Long cid, String questionId);

    /**
     * 删除子章节
     *
     * @param id
     * @return
     */
    Boolean delChildrenChapter(String id);

    Boolean delChildrenChapter(List<String> ids);

    /**
     * 根据章节id获取试题ids
     *
     * @param ids
     * @return
     */
    List<String> getQuestionIdsByChapter(List<String> ids);

    /**
     * 保存章节与试卷的关联
     *
     * @param ids
     * @return
     */
    void saveChapterPaperSet(Long categoryId, List<String> chapterIds, List<String> ids);

    /**
     * 试卷创建的章节 在删除的时候 能让试卷重新搜索
     *
     * @param chapterId
     */
    void deleteChapterPaperSet(String chapterId);

    /**
     * 基础更新
     *
     * @param entity
     * @return
     */
    ChapterModel baseUpdate(ChapterModel entity);

}
